<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta content="telephone=no" name="format-detection" />
    <!-- 留作将来统一添加 -->
    <TEMPLATE>${TEMPLATE}</TEMPLATE>
    <title>模板html</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css">
    <link rel="stylesheet" type="text/css" href="../../css/index.css">
    <link rel="stylesheet" type="text/css" href="../../css/data-flex.min.css">
    <style type="text/css">
        body {
            background: rgba(90, 194, 255, 1);
        }

        .vueApp {
            padding-bottom: 10px;
        }

        .box {
            margin: 15px;
            background: rgba(255, 255, 255, 1);
            box-shadow: 0px 4px 10px 0px rgba(0, 135, 214, 0.37);
            border-radius: 10px;
            padding: 21px 15px;
        }

        .key {
            font-size: 15px;
            font-weight: 500;
            color: rgba(25, 25, 25, 1);
            margin-right: 15px;
        }

        .input-form {
            font-size:15px;
            font-weight:400;
            color:rgba(25,25,25,1);
        }

        .input-form::placeholder {
            font-size: 15px;
            font-weight: 400;
            color: rgba(191, 191, 191, 1);
        }

        .btn {
            width: 210px;
            height: 46px;
            background-image: url("../../image/ui/btn.png");
            background-size: 100% 100%;
            background-repeat: no-repeat;
            margin: 50px auto 0 auto;
            text-align: center;
            font-size: 18px;
            font-weight: 600;
            color: rgba(124, 69, 0, 1);
            line-height: 42px;
            box-shadow: 0px 5px 7px 0px rgba(11, 126, 193, 0.53);
            border-radius: 22px;
        }
    </style>
</head>

<body>
    <div class="vueApp" v-cloak>
        <div class="box" data-flex="cross:center">
            <div class="key">
                班级名称
            </div>
            <input class="input-form" v-model.trim="className" data-flex-box="1" type="text" placeholder="班级名称">
        </div>
        <div class="btn" @click="submitFn">
            保存
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/service/service-tool.js"></script>
<script type="text/javascript" src="../../script/service/service-app.js"></script>
<script type="text/javascript" src="../../script/service/service-user.js"></script>
<script type="text/javascript" src="../../script/service/service-logic.js"></script>
<script type="text/javascript" src="../../script/jquery.min.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    // html 的引号一律为双引号(""),js 为单引号('')
    var USER, $S, vm, param;
    apiready = function () {
        $S = SERVICE();
        USER = USER();
        console.log(JSON.stringify(api.pageParam) + '=====pageParam');
        param = api.pageParam;
        fnInit();
    };
    // 初始化
    function fnInit() {
        vm = new Vue({
            el: '.vueApp',
            data: {
                className: param.className
            }
        });
    }

    function submitFn() {
        if(vm.className === '') {
            fnToast('班级名称不能为空');
            return;
        }
        if (vm.className === param.className) {
            return;
        }
        var url = 'common/updateById';
        var params = {
            "classesName": vm.className,
            "entityName": 'clsClasses',
            "id": param.classesId
        };
        var callback = function (data) {
            fnToast('修改成功');
            api.execScript({
                name: 'main',
                frameName: 'tab_index_frm1',
                script: 'getPageData()'
            })
            api.closeToWin({
                name: 'main'
            })
            // status 为200时,只返回data
        };
        POST(url, params, callback);
    }
</script>

</html>